PHP - Parse URL

Get Full Request URL

$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

Parse URL

$url_components = parse_url($url);

{ "scheme": "http", "host": "cheese.pirho.co.uk", "path": "\/API\/", "query": "Texture=Crumbly&Colour=Orange" }